package QL;

import java.util.List;
import java.util.ArrayList;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class ButlerAgentQuerySubUsersResponse extends BaseQLResponse
{
    /// <summary>
    /// 代理信息列表
    /// </summary>
    public List<ButlerAgentUserInfo> AgentUserList;

    @Override
    public void DeserializeFromJson(JSONObject jsonObj)
    {
        JSONObject t = jsonObj.getJSONObject("error_response");
        if (t != null && !t.isNullObject())
        {
            ErrCode = t.getString("code");
            ErrMsg = t.getString("msg");
        }
        else
        {
            t = jsonObj.getJSONObject("butler_agent_query_sub_users_response");
            AgentUserList = new ArrayList<ButlerAgentUserInfo>();
            JSONArray arrAgentUserList = t.getJSONObject("agent_user_list").getJSONArray("butler_agent_user_info");
            for (int i = 0; i < arrAgentUserList.size(); ++i)
            {
                ButlerAgentUserInfo o = new ButlerAgentUserInfo();
                o.DeserializeFromJson(arrAgentUserList.getJSONObject(i));
                AgentUserList.add(o);
            }
        }
    }
}
